import {getCartInfo} from '@/api/api' 
// addShopCart(skuId,skuNum) //传参两个
// getCartInfo() //不传参

export default {
  namespaced:true,
  state: {
    cartData:[]
  },
  mutations: {
    SET_CART_DATA(state,value){
      state.cartData = value
      console.log(state.cartData)
    }
  },

  actions: {  
    async getCartData(context){
      const res = await getCartInfo()
      if(res.data.data[0]){
        context.commit("SET_CART_DATA",res.data.data[0].cartInfoList)
      }else{
        context.commit("SET_CART_DATA", [] )
      }
      
    },

  },

  getters:{

  }
}
